<!DOCTYPE html>
<html onclick="setImg(event)">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style>
		body{margin:0px;background:#fff;}
	</style>
	<script>
//onclick事件触发
function setImg(e) {
	imgObj = createImg();
	//将图片追加到body下
	document.body.appendChild(imgObj);

	//设置图片位置
	var x = (e.clientX ? e.clientX : event.clientX) - imgObj.width/2;
	var y = (e.clientY ? e.clientY : event.clientY) - imgObj.height/2;
	imgObj.style.position = 'absolute';
	imgObj.style.left = x + 'px';
	imgObj.style.top = y + 'px';


}
//创建图片标签
function createImg() {
	var img = document.createElement('img');
	img.src = 'moren.gif';
	img.width = getRandom(10,180);
	img.height = img.width;
	img.onclick = deleteImg;
	return img;
}

//产生大小随机值
function getRandom(a,b) {
	var min = 	Math.min(a,b);
	var max = Math.max(a,b);
	return Math.round(Math.random()*(max-min)+min);
}

function deleteImg(event) {
	
}

function bbb() {
	var bbb;
}

	</script>
</head>
<body>
</body>
</html>